session_id=$1
session_tag=$2
Pwd=`pwd`

for i in $(seq 1 30)
do
    has_process=`ps -ef |grep ssh|grep -v sshpass|grep $session_tag |awk '{ print $2 }'`
    if [ "$has_process" = "" ]
    then
        echo "-->$has_process"
        echo "-->$session_tag"
        echo "-->$session_id"
        sleep 1
    else
        today=`date  "+%Y_%m_%d"`
        today_audit_dir="../logs/audit/$today"

        if [ -d $today_audit_dir ]
        then
            echo " ----start tracking log---- "
        else
            mkdir -p  $today_audit_dir
        fi
        #strace  -fp $has_process -t  -o "$today_audit_dir/session_$1.log"
        #bug: 如果没有写入 session_$1.log, 把路径写死了，然后在试试
        strace  -fp $has_process -t  -o   $today_audit_dir/session_$1.log

        break
    fi
done
